package com.fhj.movie.activity;


import com.fhj.movie_fhj_01.R;
import com.fhj.utils.ConnectivityUtils;
import com.fhj.utils.SharedPreferencesUtils;

import android.os.Bundle;
import android.os.Handler;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
import android.widget.ImageView;
import android.widget.Toast;

public class HyyTilePageActivity extends Activity {
	private Animation loadAnimation;
	private ImageView imageView;
	private String value;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_tile_page);
		imageView=(ImageView)this.findViewById(R.id.anim_image);
		loadAnimation = AnimationUtils.loadAnimation(this, R.anim.taste);
		LinearInterpolator  lir=new LinearInterpolator();
		loadAnimation.setInterpolator(lir);
		imageView.startAnimation(loadAnimation);
		
			if(ConnectivityUtils.isConnectivity(this)==1){
				Toast.makeText(this, "正在进行2G/3G/4G网络的连接", Toast.LENGTH_SHORT).show();
				new Handler().postDelayed(new Runnable() {
					
					@Override
					public void run() {
						// TODO Auto-generated method stub
						
							Intent intent=new Intent(HyyTilePageActivity.this,HyyTasteActivity.class);
							startActivity(intent);
							HyyTilePageActivity.this.finish();
					}
				}, 5000);
			}else if(ConnectivityUtils.isConnectivity(this)==2){
				
				Toast.makeText(this, "正在进行WIFI网络连接", Toast.LENGTH_SHORT).show();
				new Handler().postDelayed(new Runnable() {
					
					@Override
					public void run() {
						// TODO Auto-generated method stub
						
							Intent intent=new Intent(HyyTilePageActivity.this,HyyTasteActivity.class);
							startActivity(intent);
							HyyTilePageActivity.this.finish();
					}
				}, 5000);
			}else{
				Toast.makeText(this, "网络状态异常，请链接网络", Toast.LENGTH_SHORT).show();
			}
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.tile_page, menu);
		return true;
	}
}
